package com.SHA1604.tiger.app;

import android.app.Application;
import android.graphics.Bitmap;
import android.util.DisplayMetrics;

import com.SHA1604.tiger.utils.CrashHandler;
import com.squareup.picasso.LruCache;
import com.squareup.picasso.Picasso;


/**
 * ***********************************************************
 * author: alex
 * time: 16/7/26 上午10:23
 * name:
 * overview:
 * usage:
 * *************************************************************
 */
public class IApp extends Application {

    public int mScreenWidth;
    public int mHeightPixels;

    @Override
    public void onCreate() {
        super.onCreate();
        //设置全局捕捉异常的初始化
        CrashHandler.getInstance().init(this);
        initScreen();
        initPicasso();
    }

    private void initPicasso() {
        Picasso picasso = new Picasso.Builder(this)
                .memoryCache(new LruCache(10<<20))
                .defaultBitmapConfig(Bitmap.Config.RGB_565)
                .build();
        Picasso.setSingletonInstance(picasso);

    }

    private void initScreen() {
        DisplayMetrics dm = getResources().getDisplayMetrics();
        mScreenWidth = dm.widthPixels;
        mHeightPixels = dm.heightPixels;

    }
}
